package com.hirisun.wicket.ajax;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.PropertyModel;

public class AjaxLinkPage extends WebPage {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer count=0;
	

	public Integer getCount() {
		return count;
	}


	public void setCount(Integer count) {
		this.count = count;
	}


	public AjaxLinkPage(){
		
		
		
		final Label label = new Label("countLable", new PropertyModel<Integer>(this,"count"));;
		label.setOutputMarkupId(true);
		
		AjaxLink<String> ajaxLink = new AjaxLink<String>("ajaxLink") {
			@Override
			public void onClick(AjaxRequestTarget target) {
				
				count++;	
				System.out.println("1111111111':"+count);
				target.add(label);
			 
			}
		};
		
		
		add(label);
		
		add(ajaxLink);
		
	}
}
